package com.cha.chaApp.vaccination.controller;


import com.cha.chaApp.vaccination.param.VaccinationTypeParam;
import com.cha.chaApp.vaccination.service.VaccinationTypeService;
import com.cha.chaCommon.core.common.R;
import com.cha.chaCommon.core.entity.hgq.VaccinationType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
@Api(tags = "疫苗表")
@RestController
@RequestMapping("vaccination/type")
public class VaccinationTypeController  {
    @Resource
    private VaccinationTypeService vaccinationTypeService;
    @ApiOperation(
            value ="查询所有打疫苗",
            notes = "1")
    @GetMapping("/list")
    public R list(){
        List<VaccinationType> vaccinationTypes = vaccinationTypeService.selectAllVaccinationTypeById();
        return R.ok(vaccinationTypes);
    }
    @ApiOperation(
            value ="查询单个疫苗",
            notes = "1")
    @GetMapping("/type/ById")
    public R findTypeById(Integer id){
        VaccinationType vaccinationType = vaccinationTypeService.selectVaccinationById(id);
        return R.ok(vaccinationType);
    }
    @ApiOperation(
            value ="添加自定义疫苗",
            notes = "1")
    @PostMapping("/add")
    public R add(@RequestBody VaccinationTypeParam param){
        vaccinationTypeService.insert(param);
        return R.ok();
    }



}
